package 枚举;

public class Test {
    public static void main(String[] args) {
        //目标：认识枚举
        A a1 = A.X;
        System.out.println(a1 );


        //枚举的构造器是私有的，不能创建对象
        // A a = new A();

        //枚举的第一行都是常量，记住的是枚举的对象
        A a2 = A.Y;

        //枚举提供一些额外的API
        A[] as = A.values(); //as储存地址
        System.out.println(as.length); //3

        A a3 = A.valueOf("Z");
        System.out.println(a3.name());
        System.out.println(a3.ordinal());

    }
}

